﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using PhanMemDoVui.DataAccess;
using PhanMemDoVui.BusinessObject;

namespace PhanMemDoVui.BusinessLogic
{
    class BankBUS
    {
        private QuestionBank qb;
#region Constructor
        public BankBUS() { qb = new QuestionBank(); }
#endregion
#region DoiTinhDiem
        public bool DoiTinhDiem(int easy, int mode, int hard, int vhar)
        {
            qb = new QuestionBank("Bank", easy, mode, hard, vhar, qb.timeEasy, qb.timeMode, qb.timeHard, qb.timeVhar);
            string sql = string.Format("Update QuestionBank Set mark_easy = {0}, mark_mode = {1}, mark_hard = {2}, mark_vhar = {3} Where MaSo = 'Bank'", easy.ToString(), mode.ToString(), hard.ToString(), vhar.ToString());
            ConnectData conn = new ConnectData();
            return conn.ExecuteNonQuery(sql);
        }
#endregion
#region DoiThoiGian
        public bool DoiThoiGian(int easy, int mode, int hard, int vhar)
        {
            qb = new QuestionBank("Bank", qb.markEasy, qb.markMode, qb.markHard, qb.markVhar, easy, mode, hard, vhar);
            string sql = string.Format("Update QuestionBank Set time_easy = {0}, time_mode = {1}, time_hard = {2}, time_vhar = {3} Where MaSo = 'Bank'", easy.ToString(), mode.ToString(), hard.ToString(), vhar.ToString());
            ConnectData conn = new ConnectData();
            return conn.ExecuteNonQuery(sql);
        }
#endregion
#region Get
        public DataTable Get()
        {
            string sql = "Select mark_easy, mark_mode, mark_hard, mark_vhar, time_easy, time_mode, time_hard, time_vhar "
                + "From QuestionBank Where MaSo = 'Bank'";
            ConnectData conn = new ConnectData();
            return conn.GetDataTable(sql);
        }
#endregion
    }
}
